package com.itheima.wemedia.fagin;

import com.itheima.common.vo.ResultVo;
import com.itheima.wemedia.pojo.WmNews;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(name = "leadnews-wemedia",contextId = "wmNewsFeign")
public interface WmNewsFeign {
    /**
     * 远程调用自媒体微服务，根据文章id查询数据库获取文章对象
     * @param wmNewsId 文章id
     * @return 返回查询到的文章对向
     */
    @GetMapping("/api/wmNews/{wmNewsId}")
    ResultVo<WmNews> findById(@PathVariable Long wmNewsId);

    /**
     * 远程调用自媒体微服务，根据id更新文章
     * @param wmNews
     * @return
     */
    @PostMapping("/api/wmNews/update")
    ResultVo update(@RequestBody WmNews wmNews);

}
